package ux51field

import (
	"gitee.com/yanwc/ebike-vcom-device/internal/field"
	"gitee.com/yanwc/net/utils"
)

// field 37 u1
type (
	Location    field.U1
	LocationRaw field.U1Raw
)

func (l Location) Raw() (out LocationRaw) {
	copy(out[:], utils.NumberToBytesWithBigEndian(l))
	return
}

func (l LocationRaw) Type() Location {
	return utils.BytesToNumber[Location](l[:])
}

func (l LocationRaw) Slice() []byte {
	return l[:]
}

func (l Location) SatelliteLocation() bool {
	return l&Sb8SatelliteLocation == Sb8SatelliteLocation
}

const (
	Sb8SatelliteLocation Location = 0b0000_0001 // Bit0:卫星 （Bit0为0时，表示基站定位）
	Sb8BaseStateLocation Location = 0b0000_0000 //
)
